﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace C12_Ex02_Shaked_032675316_Itay_032511057
{
    public partial class GalleryDisplay : UserControl
    {
        public GalleryDisplay()
        {
            InitializeComponent();
            m_Images = null;
        }

        private IGalleryDisplayImageContainer m_Images;

        public IGalleryDisplayImageContainer Images
        {
            get { return m_Images; }
            set
            {
                m_Images = value;

                PanelPicturesDisplay.Controls.Clear();

                if (m_Images != null)
                {
                    foreach (Image image in m_Images.GetImageList())
                    {
                        PictureBox pictureBox = new PictureBox();
                        pictureBox.Image = image;
                        pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
                        pictureBox.Size = new Size(150, 150);
                        PanelPicturesDisplay.Controls.Add(pictureBox);
                    }
                }
            }
        }

        private void PanelPicturesDisplay_SizeChanged(object sender, EventArgs e)
        {
            PanelPicturesDisplay.Parent.Height = PanelPicturesDisplay.Height;
        }

        private void PanelPicturesDisplay_AutoSizeChanged(object sender, EventArgs e)
        {
            PanelPicturesDisplay.Parent.Height = PanelPicturesDisplay.Height;
        }
    }
}
